const http = require('http');
const fs = require('fs');

var server = http.createServer(function(req,res){
    var filename = './www' + req.url;
    fs.readFile(filename,(err,data)=>{
        if(err){
            res.write('404');
        }else{
            res.write(data);//机器对机器本来就是二进制，所以不用toString
        }
        res.end();
    })
})
server.listen(8080);
